package com.qiyang.lambda;

import java.util.stream.IntStream;

/**
 * Created on 2018/8/4.
 *
 * @author sehuaqi.
 * 描述：
 */
public class MinDemo {


    public static void main(String args[]) {
        //执行函数
        int[] nums = {10, 20, 50, 9, 8, 0, -5, 77};
        int min = Integer.MAX_VALUE;

        for (int i: nums) {
            if(i < min) {
                min = i;
            }
        }

        System.out.println(min);

        //jdk8 函数式编程 parallel() 多线程
        int min2 = IntStream.of(nums).parallel().min().getAsInt();
        System.out.println(min2);
    }

}
